home *** CD-ROM | disk | FTP | other *** search
- /*
- * (c) Copyright 1992 by Panagiotis Tsirigotis
- * All rights reserved. The file named COPYRIGHT specifies the terms
- * and conditions for redistribution.
- */
-
- #ifndef SCONF_H
- #define SCONF_H
-
- /*
- * $Id: sconf.h,v 5.1 1992/10/31 23:59:07 panos Exp $
- */
-
- #include "pset.h"
-
- #include "defs.h"
- #include "log.h"
- #include "mask.h"
- #include "env.h"
-
- struct rpc_data
- {
- unsigned long min_version ;
- unsigned long max_version ;
- unsigned long program_number ;
- } ;
-
-
- typedef enum { NO_ENV = 0, STD_ENV, DEF_ENV, CUSTOM_ENV } environ_e ;
-
- struct environment
- {
- environ_e env_type ;
- env_h env ;
- } ;
-
-
- /*
- * NOTE: Clearing the structure will give all its fields their default values
- */
- struct service_config
- {
- mask_t specified_attributes ; /* specified attributes */
- mask_t attributes_present ; /* includes those from defaults */
- mask_t type ; /* RPC, UNLISTED etc. */
- mask_t flags ; /* REUSE, INTERCEPT etc. */
- char *name ; /* e.g. "echo" */
- char *id ; /* e.g. "echo-stream" */
- unsigned port ; /* in host byte order */
- int socket_type ; /* e.g. SOCK_DGRAM */
- struct name_value protocol ; /* e.g. "TCP", IPPROTO_TCP */
- boolean_e wait ;
- int uid ;
- int user_gid ; /* gid corresponding to uid */
- int gid ; /* gid corresponding to group */
- char *server ;
- char **server_argv ;
- int instances ;
- pset_h env ; /* list of env strings */
- pset_h passenv ; /* env vars to pass to server */
- pset_h access_times ;
- pset_h only_from ;
- pset_h no_access ;
- mask_t log_on_success ;
- mask_t log_on_failure ;
- struct log log ;
- struct rpc_data rd ;
- pset_h disabled ; /* used only for the default entry */
- struct environment environment ;
- } ;
-
- void sconf_dump() ;
- void sconf_free() ;
-
- #define LOG( scp ) (&(scp)->log)
- #define RPCDATA( scp ) (&(scp)->rd)
- #define ENV( scp ) (&(scp)->environment)
-
- /*
- * Service types
- */
- #define ST_RPC 1
- #define ST_INTERNAL 2
- #define ST_UNLISTED 3
- #define ST_SPECIAL 4
-
- #define IS_RPC( scp ) ( M_IS_SET( (scp)->type, ST_RPC ) )
- #define IS_INTERNAL( scp ) ( M_IS_SET( (scp)->type, ST_INTERNAL ) )
- #define IS_UNLISTED( scp ) ( M_IS_SET( (scp)->type, ST_UNLISTED ) )
-
-
- /*
- * Service flags
- */
- #define SF_INTERCEPT 1
- #define SF_REUSE 2
- #define SF_NORETRY 3
-
- #define IS_INTERCEPTED( scp ) ( M_IS_SET( (scp)->flags, SF_INTERCEPT ) )
-
-
- #define MUST_LISTEN( scp ) ( (scp)->socket_type == SOCK_STREAM )
-
- #define ACCEPTS_CONNECTIONS( scp ) \
- ( (scp)->wait == NO && (scp)->socket_type == SOCK_STREAM )
-
- #define SPECIFIED( scp, attr ) \
- M_IS_SET( (scp)->specified_attributes, (attr) )
- #define SPECIFY( scp, attr ) \
- { \
- M_SET( (scp)->specified_attributes, (attr) ) ; \
- PRESENT( (scp), (attr) ) ; \
- }
- #define UNSPECIFY( scp, attr ) \
- M_CLEAR( (scp)->specified_attributes, (attr) )
-
- #define IS_PRESENT( scp, attr ) \
- M_IS_SET( (scp)->attributes_present, (attr) )
- #define PRESENT( scp, attr ) \
- M_SET( (scp)->attributes_present, (attr) )
- #define ABSENT( scp, attr ) \
- { \
- M_CLEAR( (scp)->attributes_present, (attr) ) ; \
- UNSPECIFY( (scp), (attr) ) ; \
- }
-
- #endif /* SCONF_H */
-
-